package pkg16b_eca;

import java.awt.Point;
import pkg16b_eca.data.validate.Text;

public class IntPoints extends Point {
    
    /**Extends Point, but automatically parse string. */
    public IntPoints(int x, int y) {
        this.x = x;
        this.y = y;
    }
    
    /**Extends Point, but automatically parse string.
     * Parse to IntPoints[int, int] */
    public IntPoints(String x, String y) {
        this.x = Text.parseNumber(x);
        this.y = Text.parseNumber(y);
    }
    
    /**Extends Point, but automatically parse string.
     * Parse to IntPoints[int, int] */
    public IntPoints(int x, String y) {
        this.x = x;
        this.y = Text.parseNumber(y);
    }
    
    /**Extends Point, but automatically parse string.
     * Parse to IntPoints[int, int] */
    public IntPoints(String x, int y) {
        this.x = Text.parseNumber(x);
        this.y = y;
    }
    
    /**@return Two points, x and y. */
    public int[] getPoints() {
        return new int[] {x, y};
    }
    
    /** Checking if any of the the points is empty (equals to -1). */
    public boolean isEmpty() {
        //If x or y equals to -1 return true, otherwise return false.
        if (x == -1 || y == -1) return true;
        return false;
    }
    
    /** Get the minimum value of x and y.
     * 
     * @return The one that has the lowest value of x and y.
     */
    public int min() {
        return Math.min(x, y);
    }
    
    /** Get the maximum value of x and y.
     * 
     * @return The one that has the highest value of x and y.
     */
    public int max() {
        return Math.max(x, y);
    }
}
